import React, { Component } from "react";
import { Button, Space } from "antd";

import { maxFloor } from "../define";
import "../style/floorSelector.css";

class FloorSelector extends Component {
  constructor(props) {
    super(props);
  }
  state = {};
  render() {
    const { onSelect, currentFloor } = this.props;
    return (
      <div className="floor-selector">
        <Space size={[8, 16]} wrap>
          {new Array(maxFloor).fill(0).map((v, i) => {
            return (
              currentFloor !== i + 1 && (
                <Button key={i} type="primary" size="large" onClick={() => onSelect(i + 1)}>
                  {i + 1}
                </Button>
              )
            );
          })}
        </Space>
      </div>
    );
  }
}

export default FloorSelector;
